<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/page.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/double-date.css" rel="stylesheet">
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/double-date.js"></script>
</head>

<style>
    tr{cursor: pointer;}
</style>

<script>
var url = '/{$Request.module}/getcates';
</script>

<body class="gray-bg">
    <div class="wrapper wrapper-content" id="server">

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>分类信息列表</h5>
                    </div>
                    <div class="ibox-content">                        
                        
                        <table class="table table-hover table-bordered">
                            <thead>
                                <tr>
                                    <th style="width:5%"></th>
                                    <th style="width:80%">分类名称</th>
                                    <th style="width:15%">操作</th>
                                </tr>
                            </thead>
                            <tbody id="goods_table">
                            {if condition="$list"}
							{foreach name="list" item="v"}
                                <tr>
                                    <td><input type="checkbox" class="text_id" name="goods_id[]" value="{$v.id}" /></td>
                                    <td>{$v.cate_name}</td>
                                    <td>
                                    <button type="button" class="btn btn-danger btn-xs" onclick="$(this).parent().parent().remove();"><i class="fa fa-close"></i>&nbsp;移除</button>
                                    </td>
                                </tr>
							{/foreach}
							{else/}
							<tr><td colspan="3" style="text-align:center; font-size:14px;">没有找到相关数据</td></tr>
							{/if}				
                            </tbody>
                        </table>
                        <div><button type="button" class="btn btn-primary" onclick="select_goods();">提交</button></div>

                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 全局js -->
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/admin/js/common/admin.js"></script>    
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>
    
    
<script>
function select_goods(){
    if($('input[class=text_id]:checked').length == 0){
        layer.msg('请选择分类信息', {icon: 2,time: 1000});
        return false;
    }
    //将没选中的复选框所在的  tr  remove  然后隐藏复选框
    $('input[class=text_id]:checkbox').each(function(){
    	var checked = $(this).prop('checked');
        if(!checked){
            $(this).parent().parent().remove();
        }else{
            $(this).parent().css('display','none');
            $(this).attr("checked","checked");
        }
    });
    javascript:window.parent.call_backgoods($('#goods_table').html());
}
</script>      
</body>
</html>